SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE PROCEDURE dbo.[DnnProduct_Dashboard_GetInstalledModules]
AS
	SELECT		
		DesktopModuleID, 
		ModuleName,
		FriendlyName,
		Version,
		(SELECT     COUNT(*) AS Instances
			FROM          dbo.DnnProduct_DesktopModules 
				INNER JOIN dbo.DnnProduct_ModuleDefinitions ON dbo.DnnProduct_DesktopModules.DesktopModuleID = dbo.DnnProduct_ModuleDefinitions.DesktopModuleID 
				INNER JOIN dbo.DnnProduct_Modules ON dbo.DnnProduct_ModuleDefinitions.ModuleDefID = dbo.DnnProduct_Modules.ModuleDefID
			WHERE      (dbo.DnnProduct_DesktopModules.DesktopModuleID = DM.DesktopModuleID)) AS Instances
	FROM dbo.DnnProduct_DesktopModules AS DM
	WHERE (IsAdmin = 0)
	ORDER BY [FriendlyName] ASC
GO
